-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
471 remove CodeClass
from FilteredData
#964
Conversation
Code Coverage Summary
Diff against main
Results for commit: fda506c Minimum allowed coverage is ♻️ This comment has been updated with latest results |
@@ -311,8 +311,7 @@ srv_nested_tabs.teal_module <- function(id, datasets, modules, is_module_specifi | |||
) | |||
|
|||
hashes <- calculate_hashes(datanames, datasets) | |||
metadata <- lapply(datanames, datasets$get_metadata) | |||
names(metadata) <- datanames | |||
metadata <- sapply(datanames, datasets$get_metadata, simplify = FALSE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid taking anything except get_call
and get_data
from FilteredData - please take metadata directly from the data attribute
metadata <- sapply(datanames, datasets$get_metadata, simplify = FALSE) | |
metadata <- sapply( | |
datanames, | |
function(x) attr(datasets$get_data(x, filtered = TRUE)), "metadata") | |
simplify = FALSE | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a public method, though 🤔
There is a get_metadata
function in teal
with tdata
and default
methods. Perhaps we should use that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, one more thing. On main this function looks like this:
.datasets_to_data <- function(module, datasets) {
checkmate::assert_class(module, "teal_module")
checkmate::assert_class(datasets, "FilteredData")
datanames <- if (is.null(module$datanames) || identical(module$datanames, "all")) {
datasets$datanames()
} else {
unique(module$datanames) # todo: include parents! unique shouldn't be needed here!
}
# list of reactive filtered data
data <- sapply(datanames, function(x) datasets$get_data(x, filtered = TRUE), simplify = FALSE)
hashes <- calculate_hashes(datanames, datasets)
code <- c(
get_rcode_str_install(),
get_rcode_libraries(),
get_datasets_code(datanames, datasets, hashes),
teal.slice::get_filter_expr(datasets, datanames)
)
do.call(
teal.data::teal_data,
args = c(data, code = list(code), join_keys = list(datasets$get_join_keys()[datanames]))
)
}
No metadata handling at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this just is a merge artefact?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No metadata handling at all.
You copied the function not from main
. On main .datasets_to_data
looks like this:
Line 314 in 50bbab6
metadata <- lapply(datanames, datasets$get_metadata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake. The function above is on refactor
branch.
Preprocessing code is no longer kept in
FilteredData$code
but attached to aFilteredData
as an attribute.Necessary adjustments were made in
teal_data_to_filtered_data
and inget_datasets_code
.companion